<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------
namespace app\portal\controller;

use cmf\controller\HomeBaseController;
use plugins\sy_guestbook\model\PluginSyGuestbookModel;
class FeedbackController extends HomeBaseController
{
    public function index()
    {
        return $this->fetch('/feedback');
        
    }

    public function more()
    {
        $where['isread'] = 1;
        $order ="update_time desc";
        $GuestbookModel = new PluginSyGuestbookModel();
        $guestbook = $GuestbookModel->where($where)->order($order)->paginate(12);
        // 获取分页显示
        $page = $guestbook->render();
        $this->assign("guestbook", $guestbook);
        $this->assign("page", $page);
        return $this->fetch('/feedbacklist');
    }

    public function details()
    {
        $id = $this->request->param('id', 0, 'intval');
        $guestbookModel = new PluginSyGuestbookModel();
        $detail = $guestbookModel->where(['id' => $id])->find();
        $this->assign("detail", $detail);
        return $this->fetch('/feedbackdetails');
    }
}